package com.mega.ebcs.entity;

import java.io.Serializable;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Table(name="tbl_ebcs_format")
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
public class EbcsFormat extends BaseEntity implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@EmbeddedId
	private EbcsFormatId ebcsFormatId;
	@ManyToOne
	private EbcsTransType ebcsTransType;
	private Integer length;
	private String description;
	private String type;
	private String decpoint;
	private String fixedChar;
	private String padding;
	private String paddingChar;
	
	public EbcsFormat() {
		// TODO Auto-generated constructor stub
	}
	public void setEbcsFormatId(EbcsFormatId ebcsFormatId) {
		this.ebcsFormatId = ebcsFormatId;
	}
	public EbcsFormatId getEbcsFormatId() {
		return ebcsFormatId;
	}
	public EbcsTransType getEbcsTransType() {
		return ebcsTransType;
	}
	public void setEbcsTransType(EbcsTransType ebcsTransType) {
		this.ebcsTransType = ebcsTransType;
	}
	public Integer getLength() {
		return length;
	}
	public void setLength(Integer length) {
		this.length = length;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String decription) {
		this.description = decription;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getDecpoint() {
		return decpoint;
	}
	public void setDecpoint(String decpoint) {
		this.decpoint = decpoint;
	}
	public String getFixedChar() {
		return fixedChar;
	}
	public void setFixedChar(String fixedChar) {
		this.fixedChar = fixedChar;
	}
	public String getPadding() {
		return padding;
	}
	public void setPadding(String padding) {
		this.padding = padding;
	}
	public String getPaddingChar() {
		return paddingChar;
	}
	public void setPaddingChar(String paddingChar) {
		this.paddingChar = paddingChar;
	}
	
	/* convenient method */
	public String getId() {
		if (this.ebcsFormatId == null) return "";
		return this.ebcsFormatId.getId();
	}
	public String getExchangeType() {
		if (this.ebcsFormatId == null) return "";
		return this.ebcsFormatId.getExchangeType();
	}
	
	public void setId(String Id) {
		if (this.ebcsFormatId == null) {
			this.ebcsFormatId = new EbcsFormatId();
		}
		this.ebcsFormatId.setId(Id);
	}
	public void setExchangeType(String exchangeType) {
		if (this.ebcsFormatId == null) {
			this.ebcsFormatId = new EbcsFormatId();
		}
		this.ebcsFormatId.setExchangeType(exchangeType);
	}
}
